import { LOGIN } from './actionTypes';

const initialState = {
  userInfo: {
    userName: '',
  },
};

export interface UserLoginState {
  userInfo: {
    userName?: string;
  };
}

export default function (state = initialState, action) {
  switch (action.type) {
    case LOGIN: {
      const { userName } = action.payload;
      console.log(userName);

      return {
        ...state,
        userInfo: action.payload,
      };
    }
    default:
      return state;
  }
}
